<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>DriveGet</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>DriveGet</h1>

<p>Retrieves various types of information about the computer's drive(s).</p>

<pre class="Syntax">DriveGet, OutputVar, Cmd [, Value]</pre>
<h3>Parameters</h3>
<dl>

  <dt>OutputVar</dt>
  <dd><p>The name of the variable in which to store the result of <em>Cmd</em>.</p></dd>

  <dt>Cmd, Value</dt>
  <dd>See list below.
    </dd>

</dl>

<h3>Cmd, Value</h3>
<p>The <em>Cmd</em> and <em>Value</em> parameters are dependent upon each other and their usage is described below. If a problem is encountered <em>OutputVar</em> is made blank and <a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1.</p>
<p><strong>List [, Type]</strong>: Sets <em>OutputVar</em> to be a string of letters, one character for each drive letter in the system. For example: ACDEZ. If <em>Type</em> is omitted, all drive types are retrieved. Otherwise, <em>Type</em> should be one of the following words to retrieve only a specific type of drive: CDROM, REMOVABLE, FIXED, NETWORK, RAMDISK, UNKNOWN.</p>
<p><strong>Capacity (or Cap), Path</strong>: Retrieves the total capacity of <em>Path</em> (e.g. C:\) in megabytes. Use <a href="DriveSpaceFree.htm">DriveSpaceFree</a> to determine the free space.</p>
<p><strong>Filesystem (or FS), Drive</strong>: Retrieves the type of <em>Drive</em>'s file system, where <em>Drive</em> is the drive letter followed by a colon and an optional backslash, or a UNC name such \\server1\share1. <em>OutputVar</em> will be set to one of the following words: FAT, FAT32, NTFS, CDFS (typically indicates a CD), UDF (typically indicates a DVD). <em>OutputVar</em> will be made blank and <a href="../misc/ErrorLevel.htm">ErrorLevel</a> set to 1 if the drive does not contain formatted media.</p>
<p><strong>Label, Drive</strong>: Retrieves <em>Drive</em>'s volume label, where <em>Drive</em> is the drive letter followed by a colon and an optional backslash, or a UNC name such \\server1\share1. To change the label, follow this example: <code><a href="Drive.htm">Drive</a>, Label, C:, MyLabel</code>.</p>
<p><strong>Serial, Drive</strong>: Retrieves <em>Drive</em>'s volume serial number expressed as decimal integer, where <em>Drive</em> is the drive letter followed by a colon and an optional backslash, or a UNC name such \\server1\share1. See <a href="SetFormat.htm">SetFormat</a> for how to convert it to hexadecimal.</p>
<p><strong>Type, Path</strong>: Retrieves <em>Path</em>'s drive type, which is one of the following words: Unknown, Removable, Fixed, Network, CDROM, RAMDisk.</p>
<p><strong>Status, Path</strong>: Retrieves <em>Path</em>'s status, which is one of the following words: Unknown (might indicate unformatted/RAW), Ready, NotReady (typical for removable drives that don't contain media), Invalid (<em>Path</em> does not exist or is a network drive that is presently inaccessible, etc.)</p>
<p><strong>StatusCD [, Drive]</strong>: Retrieves the media status of a CD or DVD drive, where <em>Drive</em> is the drive letter followed by a colon (if <em>Drive</em> is omitted, the default CD/DVD drive will be used). <em>OutputVar</em> is made blank if the status cannot be determined. Otherwise, it is set to one of the following strings:</p>
<table class="info">
  <tr>
    <td width="15%">not ready</td>
    <td width="85%">The drive is not ready to be accessed, perhaps due to being engaged in a write operation. Known limitation: &quot;not ready&quot; also occurs when the drive contains a DVD rather than a CD.</td>
  </tr>
  <tr>
    <td>open</td>
    <td>The drive contains no disc, or the tray is ejected.</td>
  </tr>
  <tr>
    <td>playing</td>
    <td>The drive is playing a disc.</td>
  </tr>
  <tr>
    <td>paused</td>
    <td>The previously playing audio or video is now paused.</td>
  </tr>
  <tr>
    <td>seeking</td>
    <td>The drive is seeking.</td>
  </tr>
  <tr>
    <td>stopped</td>
    <td>The drive contains a CD but is not currently accessing it.</td>
  </tr>
</table>
<p>This command will probably not work on a network drive or non-CD/DVD drive; if it fails in such cases or for any other reason, <em>OutputVar</em> is made blank and <a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1.</p>
<p>If the tray was recently closed, there may be a delay before the command completes.</p>
<p>To eject or retract the tray, see the <a href="Drive.htm">Drive</a> command.</p>
<h3>ErrorLevel</h3>
<p><span class="ver">[v1.1.04+]</span> This command is able to throw an exception on failure. For more information, see <a href="Catch.htm#RuntimeErrors">Runtime Errors</a>.</p>
<p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<h3>Remarks</h3>
<p>Some of the commands will accept a network share name as <em>Path</em>, such as \\MyServer\MyShare\</p>
<h3>Related</h3>
<p><a href="Drive.htm">Drive</a>, <a href="DriveSpaceFree.htm">DriveSpaceFree</a></p>
<h3>Example</h3>
<pre class="NoIndent"><em>; This is a working example script.</em>
FileSelectFolder, folder, , 3, Pick a drive to analyze:
if folder =
    return
DriveGet, list, list
DriveGet, cap, capacity, %folder%
DrivespaceFree, free, %folder%
DriveGet, fs, fs, %folder%
DriveGet, label, label, %folder%
DriveGet, serial, serial, %folder%
DriveGet, type, type, %folder%
DriveGet, status, status, %folder%
MsgBox All Drives: %list%`nSelected Drive: %folder%`nDrive Type: %type%`nStatus: %status%`nCapacity: %cap% M`nFree Space: %free% M`nFilesystem: %fs%`nVolume Label: %label%`nSerial Number: %serial%</pre>

</body>
</html>
